//
//  PathDrawingInfo.m
//  iPadDev01
//
//  Created by smu on 11-7-29.
//  Copyright 2011年 duk. All rights reserved.
//

#import "PathDrawingInfo.h"


@implementation PathDrawingInfo
@synthesize path, fillColor, strokeColor;
- (id)initWithPath:(UIBezierPath *)p fillColor:(UIColor *)f strokeColor:(UIColor *)s
{
    if ((self = [self init])) {
        path = [p retain];
        fillColor = [f retain];
        strokeColor = [s retain];
    }
    return self;
}

+ (id)pathDrawingInfoWithPath:(UIBezierPath *)p fillColor:(UIColor *)f strokeColor:(UIColor *)s
{
    return [[[self alloc] initWithPath:p fillColor:f strokeColor:s] autorelease];
}

- (void)dealloc
{
    self.path = nil;
    self.fillColor = nil;
    self.strokeColor = nil;
    [super dealloc];
}

- (void)draw
{
    if (self.fillColor) {
        [self.fillColor setFill];
        [self.path fill];
    }
    if (self.strokeColor) {
        [self.strokeColor setStroke];
        [self.path stroke];
    }
}

@end
